package org.depsea.oss.client;

import org.depsea.oss.model.FileStreamInfo;

import java.util.Map;

public interface PresignedUrlGenerator extends CustomerBucketPresignedUrlGenerator {

    /**
     * 获取文件信息
     *
     * @param folder 文件夹
     * @param filename 文件名
     * @return 文件信息，包含文件流
     */
    default String generate(String folder, String filename) {
        if (folder.startsWith("/")) {
            folder = folder.substring(1);
        }
        if (!folder.endsWith("/")) {
            folder = folder + "/";
        }
        return this.generate(folder + filename);
    }

    /**
     * 获取文件信息
     *
     * @param fullPath 完整的文件路径
     * @return 文件信息，包含文件流
     */
    String generate(String fullPath);

    default String generateWithArguments(String folder, String filename, Map<String, String> arguments) {
        if (folder.startsWith("/")) {
            folder = folder.substring(1);
        }
        if (!folder.endsWith("/")) {
            folder = folder + "/";
        }
        return this.generateWithArguments(folder + filename, arguments);
    }

    String generateWithArguments(String fullPath, Map<String, String> arguments);


}
